<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.11.0.min.js"></script>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<title>Insert title here</title>
<!-- 页面索引 -->
<script type="text/javascript">
	$(function(){
		var n=${page.currentpage};
		var k=${page.currentpage};
		var h=${page.sumpage};
		if(n==1){
			//$("#lastpage").css("display","none");
			$("#lastpage1").attr("disabled",true);
		}
		if(k==h){
			$("#nextpage1").attr("disabled",true);
			//$("#nextpage").css("display","none");
		}
		$("#page${page.currentpage}").css("background-color","red");
	});
</script>

<style type="text/css">

body div{border:1px solid #ccc;
}
.imagediv{width:225px;height:200px;float: left;margin-left:5px;margin-top: 5px;
}
.imagediv div{width:100%; height:20px;
}
img{width:100%; height:80%;
}
.btnmain{width:100%; height:50px;border:1px solid black;float: left;
}
</style>


</head>
<body>
<jsp:include page="/top.jsp"></jsp:include>

<div class ="main" style = "width:70%;margin-left:15%;margin-right:15%;float: left;">
	<div class="inner">
			<c:forEach items = "${AllGoods }" var = "n" varStatus="v" >
				<a href = "${pageContext.request.contextPath }/SingleGoodsServlet?goodsID=${n.goodsID}"><div class = "imagediv" >
					 <img alt="" src="${n.path }">
					 <div class = "name">${n.goodsName } </div>
					 <div class = "pricediv">价格：${n.goodsPrice } </div>
					 
					 
					</div>
				</a>
			</c:forEach>
			
	</div>
<!-- ***************页码************ -->
	<div class = "btnmain">
		<div class = "btninner" style = "margin-left: 20%; margin-right: 20%;height:100%;">
			<div style="margin-top:10px;">
		共${page.sumpage }页
		<a href="${pageContext.request.contextPath }/ShoppingServlet?page=1">  <input type="button" value="首页" id="first" disa>  </a>
		<a id="lastpage" href="${pageContext.request.contextPath }/ShoppingServlet?page=${page.currentpage-1}">  <input type="button" value="上一页" id="lastpage1">   </a>
		<c:set value="${page.sumpage }" var="sumpage" />
		
		<c:forEach begin="1" end="${page.sumpage }" var="n" step="1">
			<c:choose>
				<c:when test="${page.buttonbegin-1<n&&page.buttonend+1>n}">
					<a href="${pageContext.request.contextPath }/ShoppingServlet?page=${n}"><input type="button" value="${n }" id="page${n }"></a>
				</c:when>
			</c:choose>
		</c:forEach>
		<a id="nextpage" href="${pageContext.request.contextPath }/ShoppingServlet?page=${page.currentpage+1}">  <input type="button" value="下一页" id="nextpage1">   </a>
		<a href="${pageContext.request.contextPath }/ShoppingServlet?page=${page.sumpage}">  <input type="button" value="尾页" id="lastestpage">   </a>
	</div>
		</div>
	</div>
</div>

</body>
</html>